/*
 * main.cc
 *
 *  Created on: Feb 21, 2012
 *
 *       Author: Muhammad Zohaib Hassan
 *      Student Number : 223994
 *
 *      Description : main.cc of Project
 *
 */

#include <iostream>
#include <fstream>
#include <list>

#include"Question.hh"
#include"GameControl.hh"

#define TRUE 1

using namespace std;

int main(int argc,char* argv[])
{
    if(argc != 2){
        cout<<"Please give the name of file as command line argument";
        cout<<endl;
    }

    Question First;
    GameControl Control;

    Control.Read_Questions(argv[1]);
    cout<<"Text File Successfully Loaded."<<endl;
    cout<<"Number Of Questions - "<<Control.List_Size()<<endl;

    while(TRUE)
    {
        Control.Print_Game_Menu();
        int User_Selection=0;
        cin>>User_Selection;
        cin.ignore();

        while(User_Selection <0 || User_Selection > 7){
            cout<<"Please Select Correct Menu Item"<<endl<<"Your Choice:";
            cin>>User_Selection;
        }

          // Adding a new Question
        if(User_Selection == 1){
          Control.Add_New_Question();
        }
        // Search
        if(User_Selection == 2){
          Control.Search_Questions();
        }
          // Select
        if(User_Selection == 3){
        Control.Select(argv[1]);
        }
          // Print
        if(User_Selection == 4){
          Control.Print();
        }
          // Generate a Question Set
        if(User_Selection == 5){
          Control.Generate_Question_Set();
        }
          //Save Questions to Text File
        if(User_Selection == 6){
          Control.Save_Questions_To_File(argv[1]);
        }
          //Print Generated Question Set
        if(User_Selection == 7){
          Control.Print_Generated_Question_Set();
        }
    }
    return 0;
}


